﻿namespace XUCore.WeChat.Enterprise.Net.ServerMessages.From
{
    using Newtonsoft.Json;
    using System.Collections.Generic;
    using System.Xml.Serialization;
    using XUCore.WeChat.Net.ServerMessages.From;

    /// <summary>
    /// 异步任务完成事件推送，本事件是成员在使用异步任务接口时，用于接收任务执行完毕的结果通知。
    /// </summary>
    [XmlRoot("xml")]
    public class FromBatchJobResultEvent : FromEventBase
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="FromBatchJobResultEvent"/> class.
        /// </summary>
        public FromBatchJobResultEvent()
        {
            Event = FromEventTypes.batch_job_result;
        }


        /// <summary>
        /// 异步任务
        /// </summary>
        [XmlElement("BatchJob")]
        public BatchJobInfo BatchJob { get; set; }

        /// <summary>
        /// 异步任务
        /// </summary>
        public class BatchJobInfo
        {
            /// <summary>
            /// 异步任务id，最大长度为64字符
            /// </summary>
            /// <value></value>
            [XmlElement("JobId")]
            public string JobId { get; set; }
            /// <summary>
            /// 操作类型，字符串，目前分别有：sync_user(增量更新成员)、 replace_user(全量覆盖成员）、invite_user(邀请成员关注）、replace_party(全量覆盖部门)
            /// </summary>
            /// <value></value>
            [XmlElement("JobType")]
            public string JobType { get; set; }
            /// <summary>
            /// 返回码
            /// </summary>
            /// <value></value>
            [XmlElement("ErrCode")]
            public int ErrCode { get; set; }
            /// <summary>
            /// 对返回码的文本描述内容
            /// </summary>
            /// <value></value>
            [XmlElement("ErrMsg")]
            public string ErrMsg { get; set; }
        }
    }
}
